import Loadable from 'react-loadable';
import Loading from '../Layout/Loadding';

export const LoginPage = {
  name: 'LoginPage',
  path: '/login',
  component: Loadable({
    loader: () => import('../Login'),
    loading: Loading,
  }),
  auth: false,
  title: '登录',
};

export const Error404 = {
  name: 'Error404',
  path: '/error404',
  component: Loadable({
    loader: () => import('../Layout/Error404'),
    loading: Loading,
  }),
  auth: false,
  title: '404',
};

export const HomePage = {
  name: 'HomePage',
  path: '/',
  component: Loadable({
    loader: () => import('../Home'),
    loading: Loading,
  }),
  auth: true,
  title: '首页',
};

export const GoodPage = {
  name: 'GoodPage',
  path: '/good',
  component: Loadable({
    loader: () => import('../Good'),
    loading: Loading,
  }),
  auth: true,
  title: '详情',
};

const routerConfig = [
  LoginPage,
  Error404,
  HomePage,
  GoodPage,
];

export default routerConfig;
